A content-addressable memory (CAM) is a type of memory used in certain high-speed searching applications. In general, a CAM compares input search data (referred to as “keys”, “input keys”, or “search keys”) against a table of stored data words and returns an indication of matching words. The indication of matching words can be the data of interest or can be used to obtain the data of interest. A binary CAM (BCAM) is the simplest type of CAM that uses input keys to search through stored data words consisting entirely of logic 1's and 0's. A ternary CAM (TCAM) is a CAM that allows for a third matching state of “X” or “don't care” for one or more bits in each of the stored data words being compared with the input keys.
TCAMs can be implemented in programmable integrated circuits (ICs). Example programmable ICs include complex programmable logic devices (CPLDs) and field programmable gate arrays (FPGAs). One type of FPGA includes an array of programmable tiles. The programmable tiles comprise various types of logic blocks, which can include, for example, input/output blocks (IOBs), configurable logic blocks (CLBs), dedicated random access memory blocks (BRAM), multipliers, digital signal processing blocks (DSPs), processors, clock managers, delay lock loops (DLLs), bus or network interfaces such as Peripheral Component Interconnect Express (PCIe) and Ethernet and so forth. Each programmable tile typically includes both programmable interconnect and programmable logic. The programmable interconnect typically includes a large number of interconnect lines of varying lengths interconnected by programmable interconnect points (PIPs). The programmable logic implements the logic of a user design using programmable elements that can include, for example, function generators, registers, arithmetic logic, and so forth.
It is desirable to implement a TCAM in a programmable IC, such as an FPGA, by making efficient use of the available resources.